
<%-- 
    Document   : dish
    Created on : Feb 20, 2013, 10:53:26 AM
    Author     : Vrety
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/xml" prefix="x"%>
<%@ taglib uri="http://displaytag.sf.net" prefix="display"%>

<script language='javascript' src="js/jquery.js" type="text/javascript"></script>

<style media="all" type="text/css">

    @import "css/displaytag.css";
    #foodEssential {width:190px;height:120px;padding:10px;border:1px solid #aaaaaa;}
    #foodNoEssential {width:190px;height:120px;padding:10px;border:1px solid #aaaaaa;}
</style>
<script src="js/displayTagAjax.js">
</script>

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Dish Page</title>
        <script>
            function onload()
            {
                if(sessionScope.dishResults != null)
                {
                    document.getElementById('btnSearch').click();
                }
            }
            function onload()
            {
                if(sessionScope.dishResults != null)
                {
                    document.getElementById('btnSearch').click();
                }
            }
        </script>

    </head>
    <body onload="onload()">
        <jsp:include page="homeHeader.jsp"/>
        <div class="searchDishFood">
            <form action="ControllerServlet" method="POST">
                Tên món ăn: <input type="text" name="txtDishName" value="" />
                <input type="submit" value="SearchDishCus" name="btnAction" id="btnSearch"  />
            </form>
        </div>
        <div id="ajxDspId" style="width:50%">
            <c:choose>
                <c:when test="${empty sessionScope.dishResults }">
                    <h2>Dish not found</h2>
                </c:when>
                <c:otherwise>
                    <display:table name="sessionScope.dishResults" pagesize="10"
                                   export="false" sort="list" id="dispTables"  >
                        <display:column property="dishName" title="Dish Name"
                                        sortable="true" headerClass="sortable"/>
                        <display:column property="calories" title="Calories"
                                        sortable="true" headerClass="Image" />
                        <display:column title="Image" sortable="true"
                                        headerClass="sortable" >
                            <img alt=""  src="${pageContext.request.contextPath}/images/dish/${dispTables.imageURL}" width="200" height="200"/>
                        </display:column>

                    </display:table>

                </c:otherwise>
            </c:choose>
        </div>

    </body>
</html>